<template>
  <div class="fillcontain">
    <div class="kongge"></div>
    <div class="fillcontain-title">
      <span class="shu"></span>
      <span>规则设置记录</span>
    </div>
    <div class="chice">
      <el-form :inline="true" ref="search_data" :model="search_data">
        <el-form-item label="">
          <el-date-picker
            v-model="search_data.startTime"
            type="datetime"
            placeholder="请选择检查时间"
          >
          </el-date-picker>
          --
          <el-date-picker
            v-model="search_data.endTime"
            type="datetime"
            placeholder="请选择检查单位或检查人员名"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item>
          <el-button
            type="primary"
            size="small"
            icon="search"
            @click="onScreeoutMoney()"
            >
            <i class="fa fa-margin fa-search"></i>
            搜索</el-button
          >
        </el-form-item>
        <el-form-item class="btnRight">
          <el-button
            type="primary"
            size="small"
            icon="view"
            @click="onAddMoney()"
            >
            <i class="fa fa-margin fa-folder-open"></i>
            导出</el-button
          >
        </el-form-item>
      </el-form>
    </div>
    <div class="table_container">
      <el-table :data="tableData" border="" style="width: 100%" :row-style="{border:'none'}"  :header-cell-style="{color:'#333333',background:'#eee',fontWeight:'bold'}">
        <el-table-column prop="date" label="序号" width="180">
        </el-table-column>
        <el-table-column prop="name" label="设置机构" width="180">
        </el-table-column>
        <el-table-column prop="address" label="重点单位数"> </el-table-column>
        <el-table-column prop="address" label="一般单位数"> </el-table-column>
        <el-table-column prop="address" label="小场所"> </el-table-column>
        <el-table-column prop="address" label="其他"> </el-table-column>
        <el-table-column prop="address" label="任务生成月份"> </el-table-column>
        <el-table-column prop="address" label="任务生成时间"> </el-table-column>
         <el-table-column label="操作">
        <el-button
          size="mini"
          type="primary"
          @click="handleEdit(scope.$index, scope.row)">操作</el-button>
    </el-table-column>
      </el-table>
      <!-- 分页 -->
      <el-row>
        <el-col>
          <div class="pagination">
            <el-pagination
              v-if="paginations.total > 0"
              :page-sizes="paginations.page_sizes"
              :page-size="paginations.page_size"
              :layout="paginations.layout"
              :total="paginations.total"
              :current-page.sync="paginations.page_index"
              @current-change="handleCurrentChange"
              @size-change="handleSizeChange"
            >
            </el-pagination>
          </div>
        </el-col>
      </el-row>
    </div>
  </div>
</template>

<script>

export default {
  name: "fundlist",
  data() {
    return {
       tableData: [{
            date: '2016-05-02',
            name: '王小虎',
            address: '上海市普陀区金沙江路 1518 弄'
          }, {
            date: '2016-05-04',
            name: '王小虎',
            address: '上海市普陀区金沙江路 1517 弄'
          }, {
            date: '2016-05-01',
            name: '王小虎',
            address: '上海市普陀区金沙江路 1519 弄'
          }, {
            date: '2016-05-03',
            name: '王小虎',
            address: '上海市普陀区金沙江路 1516 弄'
          }],
      allTableData: [],
      filterTableData: [],
      dialog: {
        show: false,
        title: "",
        option: "edit",
      },
      form: {
        type: "",
        describe: "",
        income: "",
        expend: "",
        cash: "",
        remark: "",
        id: "",
      },
      //需要给分页组件传的信息
      paginations: {
        page_index: 1, // 当前位于哪页
        total: 100, // 总数
        page_size: 5, // 1页显示多少条
        page_sizes: [5, 10, 15, 20], //每页显示多少条
        layout: "total, sizes, prev, pager, next, jumper", // 翻页属性
      },
      search_data: {
        startTime: "",
        endTime: "",
      },
    };
  },
  components: {
  },
  created() {
    this.getProfile();
  },
  methods: {
    getProfile() {
      // 获取表格数据
      this.$axios("/api/profiles").then((res) => {
        // this.tableData = res.data;
        this.allTableData = res.data;
        this.filterTableData = res.data;
        // 设置分页数据
        this.setPaginations();
      });
    },
    
    
    // handleCurrentChange(page) {
    //   // 当前页
    //   let sortnum = this.paginations.page_size * (page - 1);
    //   let table = this.allTableData.filter((item, index) => {
    //     return index >= sortnum;
    //   });
    //   // 设置默认分页数据
    //   this.tableData = table.filter((item, index) => {
    //     return index < this.paginations.page_size;
    //   });
    // },
    // handleSizeChange(page_size) {
    //   // 切换size
    //   this.paginations.page_index = 1;
    //   this.paginations.page_size = page_size;
    //   this.tableData = this.allTableData.filter((item, index) => {
    //     return index < page_size;
    //   });
    // },
    // setPaginations() {
    //   // 总页数
    //   this.paginations.total = this.allTableData.length;
    //   this.paginations.page_index = 1;
    //   this.paginations.page_size = 5;
    //   // 设置默认分页数据
    //   this.tableData = this.allTableData.filter((item, index) => {
    //     return index < this.paginations.page_size;
    //   });
    // },
  },
};
</script>
<style scoped>
.kongge {
  width: 100%;
  height: 15px;
  background-color: #eee;
}
.fillcontain {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
}
.btnRight {
  float: right;
}
.pagination {
  text-align: right;
  margin-top: 10px;
}
.fillcontain-title {
  display: flex;
  flex-direction: row;
  align-items: center;
  line-height: 50px;
  border-bottom: 1px solid #eee;
}
.fillcontain-title .shu {
  width: 3px;
  height: 30px;
  background: blue;
  margin-right: 10px;
  margin-left: 10px;
}
.chice {
  margin-top: 20px;
  float: right;
   margin-right: 20px;
}
.table_container {
 
  padding: 0px 20px 0px 20px;
}
</style>